/**
 * Created with IntelliJ IDEA.
 * Description:最长回文子串
 * User: wangxin
 * Date: 2025-02-08
 * Time: 20:17
 */
public class Test1 {
    public int func(String s,int begin,int end){
        while(begin >= 0&&end < s.length()
                &&s.charAt(begin) == s.charAt(end)){
            begin--;
            end++;
        }
        return end - begin - 1;
    }
    public int getLongestPalindrome (String A) {
        // write code here
        int res= 1;
        for(int i = 0;i < A.length()-1;i++){
            res = Math.max(res,Math.max(func(A,i,i),func(A,i,i+1)));
        }
        return res;
    }
}
